import ajax from '@/utils/ajax';

export default {
  // 获取列表
  getList(data, active) {
    let fun
    switch (active) {
      case 0:
        fun = 'getConstructionStage' // 施工阶段
        break
      case 1:
        fun = 'getOverdueType' // 超期类型
        break
      case 2:
        fun = 'getResponsibleParty' // 售后责任判定
        break
      case 3:
        fun = 'getProblemType' // 售后类型划分
        break
      case 4:
        fun = 'getChangeContent' // 增减内容
        break
    }
    return ajax({
      url: '/config/' + fun,
      method: 'get',
      data
    })
  },
  // 新增
  setAdd(data, active) {
    let fun
    switch (active) {
      case 0:
        fun = 'addConstructionStage'
        break
      case 1:
        fun = 'addOverdueType'
        break
      case 2:
        fun = 'addResponsibleParty'
        break
      case 3:
        fun = 'addProblemType'
        break
      case 4:
        fun = 'addChangeContent'
        break
    }
    return ajax({
      url: '/config/' + fun,
      method: 'post',
      data
    })
  },
  // 更新
  setUpdate(data, active) {
    let fun
    switch (active) {
      case 0:
        fun = 'updConstructionStage'
        break
      case 1:
        fun = 'updOverdueType'
        break
      case 2:
        fun = 'updResponsibleParty'
        break
      case 3:
        fun = 'updProblemType'
        break
      case 4:
        fun = 'updChangeContent'
        break
    }
    return ajax({
      url: '/config/' + fun,
      method: 'post',
      data
    })
  },
  // 删除
  setDel(data, active) {
    let fun
    switch (active) {
      case 0:
        fun = 'delConstructionStage'
        break
      case 1:
        fun = 'delOverdueType'
        break
      case 2:
        fun = 'delResponsibleParty'
        break
      case 3:
        fun = 'delProblemType'
        break
      case 4:
        fun = 'delChangeContent'
        break
    }
    return ajax({
      url: '/config/' + fun,
      method: 'post',
      data
    })
  },

}